package database;

import com.mysql.jdbc.Driver;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;


/**
 * User: JAAN
 * Date: 13.05.12
 */
@Configuration
public class DatabaseConfiguration {

  @Bean
  public JdbcTemplate jdbcTemplate() {
    return new JdbcTemplate(this.dataSource());
  }

  @Bean
  public BasicDataSource dataSource() {
    BasicDataSource basicDataSource = new BasicDataSource();
    basicDataSource.setUrl("jdbc:mysql://localhost/Userinterfaces");
    basicDataSource.setUsername("root");
    basicDataSource.setPassword("mypass");
    basicDataSource.setDriverClassName(Driver.class.getName());
    return basicDataSource;
  }

}
